package com.it.myh;

/**
 * 多线程的创建:遍历100以内的偶数
 */

//1.创建一个继承于Thread类的子类
class MyThread extends Thread{

    //2.重写Thread类的run()
    @Override
    public void run() {
        for (int i = 0; i <= 100; i++) {
            if (i % 2 == 0){
                System.out.println(i);
            }
        }
    }
}
public class Ev_0216_01 {

    public static void main(String[] args) {

        //3.创建Thread类的子类的对象
        MyThread myThread = new MyThread();
        //4.通过此对象调用start()
        myThread.setPriority(10);
        myThread.start();
        System.out.println("同时执行，顺序不固定");
        System.out.println(myThread.getPriority());
    }
}
